package javaBase.JavaTreee;


/**
 * @program: jvm
 * @description
 * @author: tkk fendoukaoziji
 * @create: 2019-04-30 17:22
 **/
public class SearchTree {
    public static void main(String[] args) {
        Tree tree=new Tree();
        System.out.println("根节点"+tree.getRoot().getValue());
        //先序遍历
        tree.perOrder(tree.getRoot());
        System.out.println("树的深度是"+tree.calDepth(tree.getRoot()));
        System.out.println("先序遍历结果是：");
        for (TreeNode eNode  :tree.getResult() ) {
            System.out.print(eNode.getValue()+" ");
        }
        tree.getResult().clear();
        tree.InMiddleOrder(tree.getRoot());
        System.out.println("中序遍历结果是：");
        for (TreeNode eNode  :tree.getResult() ) {
            System.out.print(eNode.getValue()+" ");
        }
        tree.getResult().clear();
        tree.LastOrder(tree.getRoot());
        System.out.println("后序遍历结果是：");
        for (TreeNode eNode  :tree.getResult() ) {
            System.out.print(eNode.getValue()+" ");
        }

    }


}
